package book;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2022-12-05
 * Time: 15:23
 */
public class BookList {
    //初始化能够放十本书
    private static final int DEFAULT_SIZE = 10;
    private Book[] books = new Book[DEFAULT_SIZE];
    //记录当前books有多少本书
    private int useSize;

    public BookList() {
        this.books[0] = new Book("三国演义","罗贯中", 89, "小说");
        this.books[1] = new Book("西游记","吴承恩", 79, "小说");
        this.books[2] = new Book("红楼梦","曹雪芹", 69, "小说");
        this.useSize = 3;
    }
    public Book getBooks(int pos) {
        return this.books[pos];
    }

    public void setBooks(Book book) {
        this.books[this.useSize] = book;
    }

    public void setBooks(Book book, int pos) {
        this.books[pos] = book;
    }

    public int getUseSize() {
        return useSize;
    }

    public void setUseSize(int useSize) {
        this.useSize = useSize;
    }
}
